package resourceFile
import (
	"bytes"
	"geological_data_mgr/requests/common"
	resourceFileModel "geological_data_mgr/models/resourceFile"
)


/**
* ResourceFile请求类 
*/
type PageObj struct {
	common.PageObjBase
	SearchInfo SearchInfo
}
type SearchInfo struct {
 
	//`json:"aiReport"`
	AiReport *string 
	 
	//`json:"checked"`
	Checked *string  
	//`json:"content"`
	Content *string 
	 
	//`json:"fileType"`
	FileType *string  
	//`json:"name"`
	Name *string  
	//`json:"nt"`
	Nt *string  
	//`json:"rawFile"`
	RawFile *string  
	//`json:"token"`
	Token *string 
}

func (this *SearchInfo) GetConditions() string{
    var condition bytes.Buffer
    if this.AiReport != nil {
      condition.WriteString("and (resource_file.ai_report like '%" + *this.AiReport + "%')")
    }
    if this.Checked != nil {
     condition.WriteString("and (resource_file.checked = " + *this.Checked + ")")
    }
    if this.Content != nil {
      condition.WriteString("and (resource_file.content like '%" + *this.Content + "%')")
    }
    if this.FileType != nil {
      condition.WriteString("and (resource_file.file_type = '" + *this.FileType + "')")
    }
    if this.Name != nil {
      condition.WriteString("and (resource_file.name like '%" + *this.Name + "%')")
    }
    if this.Nt != nil {
      condition.WriteString("and (resource_file.nt like '%" + *this.Nt + "%')")
    }
    if this.RawFile != nil {
      condition.WriteString("and (resource_file.raw_file like '%" + *this.RawFile + "%')")
    }
    if this.Token != nil {
      condition.WriteString("and (resource_file.token like '%" + *this.Token + "%')")
    }

	if(condition.Len() > 4) {
		return " where " + condition.String()[4:]
	}
	return ""
}

type CreateObj struct {

	//`json:"aiReport"`
	AiReport *string 
	
	//`json:"checked"`
	Checked *int 
	//`json:"content"`
	Content *string 
	
	//`json:"fileType"`
	FileType *string 
	//`json:"name"`
	Name *string 
	//`json:"nt"`
	Nt *string 
	//`json:"rawFile"`
	RawFile *string 
	//`json:"token"`
	Token *string 
}
func (this *CreateObj) Convert2ResourceFile() resourceFileModel.ResourceFile  {
	var resourceFile = resourceFileModel.ResourceFile{}

	resourceFile.AiReport = this.AiReport
	
	resourceFile.Checked = this.Checked
	resourceFile.Content = this.Content
	
	resourceFile.FileType = this.FileType
	resourceFile.Name = this.Name
	resourceFile.Nt = this.Nt
	resourceFile.RawFile = this.RawFile
	resourceFile.Token = this.Token
	return resourceFile
}

type UpdateObj struct {

	//`json:"aiReport"`
	AiReport *string 
	
	//`json:"checked"`
	Checked *int 
	//`json:"content"`
	Content *string 
	
	//`json:"fileType"`
	FileType *string 
	//`json:"name"`
	Name *string 
	//`json:"nt"`
	Nt *string 
	//`json:"rawFile"`
	RawFile *string 
	//`json:"token"`
	Token *string 
}
func (this *UpdateObj) Convert2ResourceFile() resourceFileModel.ResourceFile  {
	var resourceFile = resourceFileModel.ResourceFile{}

	resourceFile.AiReport = this.AiReport
	
	resourceFile.Checked = this.Checked
	resourceFile.Content = this.Content
	
	resourceFile.FileType = this.FileType
	resourceFile.Name = this.Name
	resourceFile.Nt = this.Nt
	resourceFile.RawFile = this.RawFile
	resourceFile.Token = this.Token
	return resourceFile
}
